﻿using System.ComponentModel.DataAnnotations;
using CodeSaude.Domain.Interfaces.Repository;
using CodeSaude.Domain.Entities;
using CodeSaude.Domain.Interfaces.Service;

namespace CodeSaude.Domain.Services
{
    public class AlergiaService : BaseService<Alergia>, IAlergiaService
    {
        private readonly IAlergiaRepository _alergiaRepository;

        public AlergiaService(IAlergiaRepository alergiaRepository)
            : base(alergiaRepository)
        {
            _alergiaRepository = alergiaRepository;
        }

        public ValidationResult AdicionarAlergia(Alergia alergia)
        {
            //var resultadoValidacao = Usuario.EstaValidoParaCadastro();

            //if (resultadoValidacao.IsValid)
            base.Add(alergia);

            //return resultadoValidacao;
            return null;
        }

        public void SaveChanges()
        {
            _alergiaRepository.SaveChanges();
        }
    }
}
